<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:ubb="http://java.sun.com/jsf/composite/components">

    <p:dataTable value="#{taskManager.tasks}" var="task" emptyMessage="#{msg['managerPage.taskManagement.tasks.emptyTable']}..." styleClass="tasksTable"
                 filteredValue="#{taskManager.filteredTasks}" rendered="#{managerView.activePanel == 'LIST_TASKS'}"  rowIndexVar="taskIndex">
        <p:columnGroup type="header">
            <p:row>
                <p:column headerText="#{msg['managerPage.taskManagement.name']}" />
                <p:column headerText="#{msg['managerPage.taskManagement.section']}" />
                <p:column colspan="2" headerText="#{msg['managerPage.taskManagement.description']}" />
            </p:row>
            <p:row>
                <p:column filterBy="#{task.name}" filterMatchMode="contains" />
                <p:column filterBy="#{task.section.sectionName}" filterMatchMode="contains" />
                <p:column colspan="2" style="background:transparent" />
            </p:row>
        </p:columnGroup>
        <p:column>
            <h:outputText value="#{task.name}" />
        </p:column>
        <p:column>
            <h:outputText value="#{task.section.sectionName}" />
        </p:column>
        <p:column styleClass="description">
            <h:outputText value="#{task.description}" title="#{task.description}" />
        </p:column>
        <p:column styleClass="actions">
            <p:commandLink action="#{taskManager.edit(task)}" update="@form" >
                <h:graphicImage library="images" name="edit-16.png" />
                <h:outputText value="#{msg['Common.edit']}" />
            </p:commandLink>
            <p:commandLink onclick="confirmTaskDelete#{taskIndex}.show();return false;">
                <h:graphicImage library="images" name="trash-16.png" />
                <h:outputText value="#{msg['Common.delete']}" />
            </p:commandLink>
            <p:commandLink id="deleteTask" action="#{taskManager.delete(task)}" update="@form" value="Execute" style="display: none" />
            <ubb:confirmationDialog title="#{msg['managerPage.taskManagement.tasks.delete.confirmationTitle']}" message="#{msg['managerPage.taskManagement.tasks.delete.confirmationMessage']}"
                                    actionButtonId="#{p:component('deleteTask')}" widgetVar="confirmTaskDelete#{taskIndex}" />
        </p:column>
    </p:dataTable>
    <h:panelGroup rendered="#{managerView.activePanel == 'LIST_TASKS'}" layout="block" styleClass="buttonPanel">
        <p:commandButton value="#{msg['managerPage.taskManagement.tasks.createNew']}" action="#{managerView.switchPanel('NEW_TASK')}" update="@form" icon="add" process="@this" />
        <p:commandButton value="#{msg['Common.cancel']}" action="#{managerView.switchPanel('DESCRIPTION')}" update="@form" icon="cancel" process="@this" />
    </h:panelGroup>
</ui:composition>